package com.mobis.base.controller;


import com.mobis.base.pojo.Label;
import com.mobis.base.service.LabelService;
import entity.Result;
import entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/label")
public class LabelController {
    @Autowired
    private LabelService labelService;

    @RequestMapping(method = RequestMethod.GET)
    public Result findAllLabel(){
        System.out.println("1234");
        List<Label> list=labelService.findAllLabel();

        return new Result(true, StatusCode.OK,"查找全部成功",list);
    }

    @RequestMapping(value = "",method = RequestMethod.POST)
    public Result addLabel(@RequestBody Label label){
        labelService.addLabel(label);
        return new Result(true,StatusCode.OK,"添加成功");
    }

    @RequestMapping(value = "/{id}",method = RequestMethod.GET)
    public Result findLabelById(@PathVariable String id){
        Label label=labelService.findById(id);
        return new Result(true,StatusCode.OK,"查找成功",label);
    }

    //条件查询



    //分页条件查询
    @RequestMapping(value = "/search/{page}/{size}")
    public Result findSearch(@RequestBody Map searchMap,@PathVariable int page,@PathVariable int size){

//        Page pageData=labelService

        return new Result(true,StatusCode.OK,"查找成功");
    }



}
